package com.mxwl.cbg.common.model.source.role;

import com.mxwl.cbg.common.config.GameConfig;
import lombok.Data;

import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * 人物技能
 */
@Data
public class Skills {
    //原始数据
    private Map<String, String> all_skills;
    //剧情技能剩余技能点
    private Integer iSkiPoint;
    //打造熟练度
    private Integer iSmithski;
    //裁缝熟练度
    private Integer iSewski;
    //部门技能中临时符技能的数量
    private Integer lsf_skill_num;

    public void setAll_skills(Map<String, String> all_skills) {
        this.all_skills = all_skills;
        this.lsf_skill_num = countTheNumberOfTemporarySkills();
    }
    private Integer countTheNumberOfTemporarySkills() {
        List<Integer> lsfSkills = GameConfig.getLSFSkills();
        AtomicInteger count = new AtomicInteger();
        all_skills.forEach((k, v) -> {
            if (lsfSkills.contains(Integer.valueOf(k))) {
                count.getAndIncrement();
            }

        });
        this.lsf_skill_num = count.get();
        return lsf_skill_num;
    }
}
